#ifndef CCR_CONTEXT_H
#define CCR_CONTEXT_H

#include <iomanip>
#include <iostream>
#include <limits>

#include <grape/grape.h>
#include "ccr/tree_type.hpp"

namespace grape {
template <typename FRAG_T>
class CCRContext : public VertexDataContext<FRAG_T, double> {
 public:
  using oid_t = typename FRAG_T::oid_t;
  using vid_t = typename FRAG_T::vid_t;
  explicit CCRContext(const FRAG_T& fragment)
      : VertexDataContext<FRAG_T, double>(fragment, true)
  // ,        partial_result(this->data())
  {}

  void Init(ParallelMessageManager& messages, std::string vertex_file,
            std::string edge_file) {
    this->vertex_file_path_ = vertex_file;
    this->edge_file_path_ = edge_file;
  }

  void Output(std::ostream& os) override {
    // If the distance is the max value for vertex_data_type
    // then the vertex is not connected to the source vertex.
    // According to specs, the output should be +inf
    os << "ccr output\n";
  }
  std::string edge_file_path_;
  std::string vertex_file_path_;
  std::unordered_map<uint32_t, uint32_t> global2local_;
  // 记录跨分区的出边和入边
  // std::unordered_map<uint32_t, std::vector<uint32_t>> inedge_;
  // std::unordered_map<uint32_t, std::vector<uint32_t>> outedge_;
  std::vector<std::vector<uint32_t>>inedge_;
  std::vector<std::vector<uint32_t>>outedge_;
  // typename FRAG_T::template vertex_array_t<double>& partial_result;

  std::unique_ptr<Graph> curent_graph_, next_graph_;  // 使用指针可能更加方便
};
}  // namespace grape

#endif